<template>
  <div>user模块
    <p>姓名：{{ name }}</p>
    <p>性别：{{ sex }}</p>
    <p>年龄：{{ age }}</p>
    <button @click="changeAge">增加年龄</button>
    <button @click="changeName">改变姓名</button>
  </div>
</template>

<script setup>
import { useUserStore } from '../store/user.js'
import { storeToRefs } from 'pinia'
const user = useUserStore()
const { name, sex, age } = storeToRefs(user)
const changeAge = () => {
  user.changeAge()
}
const changeName = () => {
  user.changeName()
}
</script>